package io;

import java.io.*;

public class Demo7 {
    public static void main1(String[] args) {
        try(Reader reader=new FileReader("C:/test/text.txt")){
            while (true){
                char[] chars=new char[1024];
                int n=reader.read(chars);
                if (n==-1){
                    break;
                }
                for (int i = 0; i < n; i++) {
                    System.out.println(chars[i]);
                }
            }
        }catch (IOException e){
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        try(Writer writer=new FileWriter("C:/test/text.txt",true)){
            writer.write("hello word");
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
